local sk__kuangxi = fk.CreateSkill {

  name = "sk__kuangxi",

  tags = {  },

}



sk__kuangxi:addEffect(fk.CardUseFinished, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk__kuangxi.name) and data.card.type == Card.TypeTrick and
      table.find(data.tos, function (id)
        return not id.dead
      end)
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askForSkillInvoke(player, sk__kuangxi.name, nil, "#sk__kuangxi-invoke:::"..data.card:toLogString())
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local targets = table.filter(data.tos, function (id)
      return not id.dead
    end)
    room:sortByAction(targets)
    local use = room:useVirtualCard("slash", nil, player, targets, sk__kuangxi.name, true)
    if use and not use.damageDealt and not player.dead then
      room:loseHp(player, 1, sk__kuangxi.name)
    end
  end,
})

return sk__kuangxi